home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1993 / Internet Info CD-ROM (Walnut Creek) (1993).iso / networking / archival / fsp / INFO < prev    next >
Encoding:
Text File  |  1992-04-08  |  13.7 KB  |  332 lines

  1.                         Interested party please email
  2.                         wen-king@vlsi.cs.caltech.edu
  3.     What is the purpose of FSP (V2.5):
  4.  
  5.     FSP is a set of programs that implements a public-access archive
  6.     similar to an anonymous-FTP archive.  It is not meant to be a
  7.     replacement for ftp; it is only meant to do what anonymous-ftp
  8.     does, but in a manner more acceptible to the provider of the
  9.     service and more friendly to the clients. 
  10.  
  11.     Providing anonymous-FTP service can be costly --- each active
  12.     session consumes one process slot in the OS and one stream socket
  13.     entry in the network sub-system.  The servers can also run
  14.     concurrently, adding to the system load.  A popular archive site
  15.     can easily be overwhelmed as a result.  Some were forced to
  16.     shutdown or and some impose inconvienent access restrictions. 
  17.  
  18.     Unlike FTP, FSP is connection-less and virtually state-less.  One
  19.     server handles requests from all clients machines.  Each active
  20.     client machine takes up 16-bytes in a dynamically extensible
  21.     table.  Since only one server runs at any time, the load added
  22.     to the server machine is no more than one.
  23.  
  24.     In exchange for allowing site operators to keep their sites open
  25.     and do away with cumbersome access restrictions, this is what the
  26.     clients accept with FSP: 
  27.  
  28.      1) Lower transfer rate.  The maximum rate is 1 kbyte per UDP
  29.         message round-trip time between the client and the server.
  30.     
  31.     In addition to the potential for more abundant sites and more
  32.     accessible sites, this is what the clients gain with FSP:
  33.  
  34.      1) Robustness.  Since FSP is connectionless, flucturations in
  35.         the network will not abort a FSP transaction.  Furthermore,
  36.         the 16-bytes of data for each client can be regenerated at
  37.         any point during any transaction.  Thus, if the server goes
  38.         down at any point during a transaction, the transaction will
  39.         resume when the server is restarted.  (like NFS) 
  40.  
  41.      2) Friendlier user interface.  FSP does not have its own command
  42.         interpretor like FTP.  Since it is connectionless, there is
  43.         no reason to carry much information from one command to the
  44.         next, and the commands can all be made into individual unix
  45.         programs.  For instance, there is one program you run to list
  46.         the directory and another you run to download a file. 
  47.  
  48.      3) Client protection.  FSP oversees a directory structure similar
  49.         to that of an anonymous-FTP.  However, a directory created
  50.         via FSP transaction is owned by the client machine that issued
  51.         the creation request.  The client can create and delete files
  52.         and subdirectories in that directory.  In addition, the client
  53.         can enable any of the two attributes for that directory: 
  54.  
  55.         A) Give all other clients the permission to create files
  56.            and subdirectries.
  57.  
  58.         B) Give all other clients the permission to delete files
  59.            and subdirectories.
  60.  
  61.         Note: A subdirectory can be deleted if it is empty and the
  62.           client owns the subdirectory.
  63.  
  64.      4) Server protection.  FSP server does not spawn sub-programs.
  65.         It will accept only paths that are downward relative to its
  66.         designated working directory.  On systems with symbolic links,
  67.         the server will follow symbolic links, but it does not follow
  68.         uplinks ("..").  Clients cannot create symbolic links and
  69.         care should be taken so that other users on the server machine
  70.         cannot create symbolic links in the server's work space. 
  71.  
  72.         It is also fairly difficult to formuate an attack to force a
  73.         shutdown of a FSP site by actions of a rogue site.  About the
  74.         only way to distrupt a FSP service is to flood the FSP site
  75.         with network packets.  FSP server prevents itself from
  76.         'counter-flooding' by filtering for legitimate requests using
  77.         the following method:
  78.  
  79.         A) Each request message contains a key.  For each client,
  80.            server database contains the keys to be used for the
  81.            next client request and for the previous client request.
  82.  
  83.         B) If the next request does not contain a key that matches
  84.            either of the two keys, it is accepted only if at least
  85.            one minute has elapsed since the last time a request
  86.            is accepted.  If the key does match the old key
  87.            (retransmit) it is accepted if the elapse time is
  88.            greater than 3 seconds.
  89.  
  90.         C) Every request message accepted is acknowledged with
  91.            one reply message.  The reply message contains a new
  92.            key to used for the next request.  The new key is
  93.            computed by the server with a pseudo-random number
  94.            generator. 
  95.  
  96.         Flooding is a ballant violation of network etiquette because
  97.         a site can be subjected to flooding attack whether it has FSP
  98.         running or not, and flooding congests every link and gateway
  99.         between the rogue client and the server.  As a further measure
  100.         of protection, the server loads a table of rogue clients on
  101.         startup.  The server will not respond to requests from any of
  102.         those clients.
  103.  
  104.     The software set:
  105.  
  106.     common_def.h    This C header file contains definitions common to
  107.             both the server code and the client code.
  108.  
  109.     client_def.h    This C header file contains definitions for the
  110.             client code.
  111.  
  112.     server_def.h    This C header file contains definitions for the
  113.             server code.
  114.  
  115.     udp_io.c    This file contains the lowest level routines that
  116.             deal with the unix inet sockets.  This file is
  117.             used by both the server code and the client code.
  118.  
  119.     server_main.c    Main routine and dispatch loop for the server.
  120.     server_host.c    Routines for maintaining client database.
  121.     server_file.c    Routines for file i/o.
  122.     server_lib.c    Routines for inet socket i/o.
  123.  
  124.     client_lib.c    Core routines of the client library.
  125.     client_util.c    Supplementry routines of the client library.
  126.     client_lock.c    udp packet multiplexing mechanism.
  127.  
  128.     bsd_src/    Directory containing additional sources derived
  129.             from those in public archive on uunet.uu.net.  It
  130.             contains a BSD random/srandom routine, a modified
  131.             BSD globbing routine, a modified "ls" source.
  132.  
  133.     fcdcmd.c    These compiles into individual client utilities.
  134.     fgetcmd.c    Those with a "cmd" in their name will do their
  135.     flscmd.c    own globbing on their argv base on directory
  136.     fprocmd.c    information obtained from the server.
  137.     frmcmd.c
  138.     frmdircmd.c
  139.     fcatcmd.c
  140.     fmkdir.c
  141.     fput.c
  142.     fver.c
  143.     fgrab.c
  144.  
  145.     Compilation:
  146.  
  147.     FSP has been compiled and tested on a SS-2 running SunOs 4.1.1,
  148.     a HP-9000 running HP UNIX, a VAX-780 running 4.3-tahoe, and a 386
  149.     box running system-V UNIX with old Excelan ethernet interface.
  150.     It has also been compiled on a variety of machines by over a
  151.     hundred users across the net. 
  152.  
  153.     To compile the software, you must first successfully complete a
  154.     "make" in the bsd_src directory.  You may have to change a few
  155.     files.  In particular, you may have to edit "Makefile" and "tweak.h"
  156.     in bsd_src directory. 
  157.  
  158.     When that is done, you can edit the Makefile on the top directory
  159.     and run "make" in the top directory.  You may have to read through
  160.     the rest of this document first before making changes to the Makefile.
  161.  
  162.     Server Administration:
  163.  
  164.     The only things you need for setting up a FSP server is a work
  165.     directory for the service and and the FSP server itself (fspd).
  166.     fspd can run independently or it can be run under inetd.  When
  167.     running independently, fspd waits for messages through a UDP
  168.     socket whoes port number is defined in the Makefile.  When running
  169.     under inetd, fspd is involked as in.fspd.  inetd will spawn fspd
  170.     when a message arrives for the FSP socket.  The fspd process will
  171.     take over and stick around to wait on additional messages.  After
  172.     it has become idle for 2 minutes, fspd will exit and return control
  173.     to inetd. 
  174.  
  175.     Sample setup for inetd operation:
  176.  
  177.         In /etc/services file:
  178.  
  179.         fsp             21/udp          fspd
  180.  
  181.         In /etc/inetd.conf file:
  182.  
  183.         fsp dgram   udp wait ftp /usr/etc/fspd in.fspd
  184.  
  185.         In this sample, the same port number for ftp is used for the
  186.         fsp socket.  There will not be a conflict because ftp uses
  187.         stream protocol, and fsp uses UDP protocol.  The fspd program
  188.         in this example is ran under user 'ftp'. 
  189.  
  190.     In addition, fspd will accept these flags:
  191.  
  192.         -h absolute_path    Set fsp work directory.  Overrides the
  193.                 compiled-in default.
  194.  
  195.         -p udp_port_number  Set UDP port number.  Overrides the
  196.                 compiled-in default.
  197.  
  198.         -u uid_number       Assume this uid after startup.  If present,
  199.                 fspd will attempt a setuid() to this uid
  200.                 number.  It will exit if setuid() fails.
  201.  
  202.         -d                  Turn on debug mode.  The stdio files will
  203.                 remain open in debugging mode.
  204.  
  205.     When fspd starts, it chdir to its work directory where it looks
  206.     for (and reads in if found) a list of internet numbers in the
  207.     standard 4-part form: ddd.ddd.ddd.ddd in the file ".ROGUE_HOSTS".
  208.     This file is prepared by the FSP maintainer, and is used to
  209.     indicate that fspd should not respond to any requests from these
  210.     machines.   After that, it begins to service any requests it gets
  211.     on the UDP socket.
  212.  
  213.     If a file .OWN.XXXXXXXX, where XXXXXXXX is an 8-digit hex number,
  214.     exists in a directory in fspd's work space, the directory is owned
  215.     by the machine whoes inet number is XXXXXXXX, where the number
  216.     is printed as a hexadecimal number.  If no such file exists, the
  217.     directory has no owner.  (Note, the 'dot' files are hidden from
  218.     clients).
  219.  
  220.     If the file .FSP_OK_DEL does not exists in a directory, only the
  221.     owner is allowed to remove items from that directory. 
  222.  
  223.     If the file .FSP_OK_ADD does not exists in a directory, only the
  224.     owner is allowed to add items into that directory. 
  225.  
  226.     Thus, you typically want to protect the top directory by leaving
  227.     out the .FSP_OK_DEL, .FSP_OK_ADD files, and .OWN.XXXXXXXX files
  228.     in the top directory. 
  229.  
  230.     Clients do not get to read the directory information directly.
  231.     Instead, fspd maintains a directory listing in the file .FSP_CONTENT
  232.     in each directory.  When a client requests information for a
  233.     directory, the .FSP_CONTENT file is created if it doesn't exist,
  234.     and it is rebuilt if it is out of date.  The information is
  235.     accessed by having the client read the directory listing file.
  236.     Care is taken so that the client will not get corrupted entries
  237.     when the directory is changed while the listing is being read. 
  238.  
  239.     Files being uploaded are first written to a temporary file in the
  240.     work directory: .TXXXXXXXXYYYY where XXXXXXXX is the inet number
  241.     of the client, and YYYY is the port number of the client program.
  242.     When upload is compelete, the file is moved into the intended
  243.     location. 
  244.  
  245.     An 'alarm' interrupt will cause fspd to dump its current client
  246.     database into the file .HTAB_DUMP in the work directory.  This
  247.     can be useful for debugging and for catching rogue clients.
  248.  
  249.     Client utilities:
  250.  
  251.     All inter-command states are kept in these four shell environment
  252.     variables.
  253.  
  254.         FSP_PORT        Port number of the fspd you wish to contact.
  255.         FSP_HOST        Host name or number of the fspd.
  256.         FSP_DIR        Your current working directory in the archive.
  257.  
  258.     When multiple client utilities are run at the same time on the
  259.     same client machine, packet multiplexing mechanisms can be used
  260.     to enable concurrent access to the same fsp database.  If none
  261.     of the mechanisms are selected at compile time, FSP_LOCALPORT
  262.     can be used to ensure that only once client utility can run at
  263.     any time.  In this case, FSP_LOCALPORT can be set to any port
  264.     number not current used on the client machine.
  265.  
  266.     FSP_TRACE can be set if you want status reports be printed while
  267.     files are being transferred.  FSP_DELAY variable can be used to
  268.     set the retransmit interval for client utilities (in thousandth
  269.     of a second).  The retransmit rate is adjusted in an exponential
  270.     manner, until the retry rate reaches 5 mintes per retry.
  271.  
  272.     FSP_BUF_SIZE can be set to a positive number less than or equal
  273.     to 1024.  When set, it determines the size of data to be send for
  274.     each request during file and directory information transfer.  The
  275.     default is 1024.  Some sites are connected via links that cannot
  276.     transmit buffers containing 1024 bytes of data in addition to the
  277.     header information.  Setting FSP_BUF_SIZE to a lower value will
  278.     allow these sites to access fsp archives.
  279.  
  280.     A typical setup looks like this:
  281.  
  282.         setenv FSP_PORT     21
  283.         setenv FSP_HOST     131.215.131.97
  284.         setenv FSP_DIR     /
  285.         setenv FSP_TRACE
  286.         setenv FSP_DELAY     3000
  287.         setenv FSP_BUF_SIZE  1024
  288.  
  289.     (All examples will be in csh.  However, it is assumed that similar
  290.      things can be done with other shells)
  291.  
  292.     For commands that do globbing using remote directory info, normal
  293.     shell globbing needs to be turned off.  In csh, it can be done
  294.     with a set of aliases: 
  295.  
  296.         alias fcd setenv FSP_DIR \`\(set noglob\; exec fcdcmd \!\*\)\`
  297.         alias fls    \(set noglob\; exec flscmd    \!\*\)
  298.         alias fget   \(set noglob\; exec fgetcmd   \!\*\)
  299.         alias fgrab  \(set noglob\; exec fgrabcmd  \!\*\)
  300.         alias fcat   \(set noglob\; exec fcatcmd   \!\*\)
  301.         alias frm    \(set noglob\; exec frmcmd    \!\*\)
  302.         alias frmdir \(set noglob\; exec frmdircmd \!\*\)
  303.         alias fpro   \(set noglob\; exec fprocmd   \!\*\)
  304.     
  305.     In addtion, this alias is useful:
  306.  
  307.         alias fpwd echo \$FSP_DIR on \$FSP_HOST port \$FSP_PORT
  308.  
  309.     Commands:
  310.  
  311.         fver    display server's version number.
  312.         fcd        change current remote directory, like cd.
  313.         fls        list directory.  works like ls.
  314.         fget    get the named files.
  315.         fgrab    get the named file and delete it from remote directory.
  316.         fput    put the named files.
  317.         fcat    get the named files and send them to stdout.
  318.         fmkdir    make named directories.
  319.         frm        delete named files.
  320.         frmdir    delete named directories.
  321.  
  322.         fpro    no arg: display directory protection modes.
  323.                 +c: give others permission to create new items.
  324.                 -c: deny others permission to create new items.
  325.                 +d: give others permission to delete old items.
  326.                 -d: deny others permission to delete old items.
  327.  
  328.     ***********************************************************************
  329.  
  330.     This is a free software.  Be creative; make your own macros and tools
  331.     and let me know of any bugs and suggestions.
  332.